#requests库，python英特尔
#pip install requests
import requests

h = {
    'user-agent' : 'Mozilla/5.0(Windows NT 10.0;)'AppleWebkit/537.36(KHTML,like Gecko) Chore/136.0.0.0
    Safari/537.36 Edg/136 
    
    )

}
req = requests.get('https://digital.it168.com/chanel-9-att-1-1-page-1.shtml',headers={})
print(req.status_code) # 状态码
#print(dir(req))
#print('url',req.connection)
# print('connection',req.request)
# print('请求的对象')
#print('url',req.url)

# print('connection', req.connection)
# print('headers',req.headers)
# print('请求的对象',req.request)
# session会话
# security
# print('content',req.content)
# print('text',req.text)



from bs4 import Beautifulsoup
soup = Beautifulsoup(req.content, 'html.parser'）
# print(soup.prettify())content_left = soup.find('div',class_='relevant pub-bg')
items = content_left.find_all('li'）
items = items[e]
mess = item.find('div', class_='mess')
title = mess.find('a').text
txt = mess.find("p').text
img = item.find("img')['src']

print(type(items), len(items))
print(title)
print(txt)
print(img)

        